<?php 

$sql = "SELECT			 
			
			c.catalog_id,
			c.doc_description,
			
			d.title,
			d.description,
			d.meta_key,
			d.meta_description
		FROM
			catalog AS c,
			catalog_description AS d
		WHERE
		
			c.catalog_id = d.catalog_id
			AND
			d.lang_id = '1'
			AND c.published
			AND 
			c.sef_url = '".escape($sef_url)."'
			
		  ";
$result = query($sql);
$row = mysql_fetch_object($result);
//if(!$row->catalog_id) redirect(HTML_BASE.'products/');

head($row->title,$row->meta_description,$row->meta_key);
menue();

	$sql_details = "SELECT
						g.detail_id,
						g.filename,
						d.description
						
					  FROM
						detail AS g,
						detail_description AS d
						
						WHERE
						g.detail_id = d.detail_id
						AND
						d.lang_id = '1'
						
						ORDER BY 
						g.order_number DESC
					";
		
			$result_details = query($sql_details);
			$detatils = '';
			$first_detail;
			$detailnum = 0;
			
            while ($row_details = mysql_fetch_object($result_details)) {
				
				$detatils .= "{href:'".HTML_BASE."details/".$row_details->filename."', title: '".$row_details->description."'},";
				if($detailnum == 0 ) $first_detail = HTML_BASE."details/".$row_details->filename;
				$detailnum++;
			}
				$detatils = substr($detatils, 0, -1);

?>


<script>
/* <![CDATA[ */
$(document).ready(function() {
	$('.details').click(function(e){
		e.preventDefault();
$.fancybox([

<?=$detatils?>
],{
//			href: this.href,
			helpers: {
				overlay: {
				opacity: 0.3
				} // overlay
				//, buttons: {}
			} // helpers
		}); // fancybox
	}); // click
	
$(".size").click(function(){
$.fancybox({
	type: 'html',
	autoSize: false,
	content: '<embed src="'+this.href+'#nameddest=self&page=1&view=FitH,0&zoom=80,0,0" type="application/pdf" height="'+($(window).height() - 100)+'" width="'+($(window).width() - 100)+'" />',
	beforeClose: function() {
		$(".fancybox-inner").unwrap();
	},
		helpers: {
			overlay: {
			opacity: 0.3
			} // overlay
		}
}); //fancybox
return false;
}); //click	

$("#inq-form").fancybox({
	'scrolling'		: 'no',
	'titleShow'		: false,
	'onClosed'		: function() {
	    
	}
});
}); // ready
/* ]]> */


</script>

<style type="text/css">
#wrap { width: 100%;}
a {outline: 0 none;}
</style>
<div id="content" class="product">
		
		<div id="pathway">
			<a href="<?=HTML_BASE?>">начало</a>/<a href="<?=HTML_BASE?>products/">продукти</a>/
		</div>
		
		<h1><?=$row->title?></h1>
		
		<div id="product-description">
			
			<div id="left">
				<div id="images">
                <?php
                
				$sql_image = "SELECT
					image_id,
					image,
					top
					
				  FROM
					catalog_image
				WHERE 
				 catalog_id = '".$row->catalog_id."'
				 
				 ORDER BY top DESC
				  
					";
		
			$result_image = query($sql_image);
		
            while ($row_image = mysql_fetch_object($result_image)) {
				
				?>
					<img src="<?=HTML_BASE?>catalogimage/<?=$row->catalog_id?>/<?=$row_image->image?>">
					
                <?php }?>   
				</div>
				
				<a id="inq-form"  href="#inquiry-form" class="button">Запитване за този продукт</a>
				
				<a class="size" href="<?=HTML_BASE?>pdf/<?=$row->doc_description?>">размери</a>
				<a class="details" href="<?=$first_detail?>">детайли</a>
				
			</div>
            
	
			<div id="right">
				
				<?=stripslashes($row->description)?>
				
			</div>
		
		</div>
		
	</div>
	
<?php foot($sef_url); ?>

<script src="<?=HTML_BASE?>js/product.js" type="text/javascript"></script>
</body>
</html>

        
        
        
  